\(\color{darkblue}{\textbf{Fundamentals}}\)


\(\color{dodgerblue}{\textbf{Role of Data Scientist}}\)


\(\color{dodgerblue}{\textbf{Modeling is Not Enough}}\)

\(\color{darkblue}{\textbf{Figure Types}}\)


\(\color{dodgerblue}{\textbf{Histogram}}\)

Shows the binned distribution of a continuous variable


\(\color{skyblue}{\textrm{- Basic Plot}}\)

Required: x


\(\color{skyblue}{\textrm{- Frequency}}\)

Optional: y (which makes it frequency instead of count)


\(\color{dodgerblue}{\textbf{Bar}}\)

Shows the distribution of a discrete variable


\(\color{skyblue}{\textrm{- Absolute Count Bar}}\)

Required: x
Function: geom_bar()


\(\color{skyblue}{\textrm{- Distribution Bar}}\)

Shows a selected statistic for each category of the variable selected

Required: x, y
Function: geom_col()


\(\color{darkblue}{\textbf{Aesthetics}}\)


\(\color{dodgerblue}{\textbf{Controls}}\)

Aesthetic Description Values
x x-axis data
y y-axis data
color color of dots, outline of other shapes
fill fill color Same as color
alpha transparency
size diameter of points, thickness of lines
linetype line dash pattern
labels text on a plot or axes see below
shape shape of dot


\(\color{skyblue}{\textrm{- Color Palettes}}\)

Brewer

scale_color_brewer(palette = "Spectral")
scale_fill_brewer(palette = "Spectral")

Manual

scale_color_manual(values = c("color", "color", "color"))
scale_fill_manual(values = c("color", "color", "color"))


\(\color{dodgerblue}{\textbf{Text Location}}\)

\(\color{darkblue}{\textbf{Axes}}\)


The scale_ functions include whether the axis is _x_ or _y_ and whether the variable plotted is _discrete() or _continuous():

  • scale_x_discrete()
  • scale_y_continuous()


\(\color{dodgerblue}{\textbf{Limiting}}\)

Caution, this will drop data outside of the limits (including bars)


\(\color{dodgerblue}{\textbf{Setting Breaks}}\)

Caution, this will still plot points outside of the range of the breaks leaving the rest of the y axis blank


\(\color{dodgerblue}{\textbf{Setting Labels}}\)

Caution, the numbero f labels must equal the number of breaks


scales formats:

  • comma
  • percent
  • scientific


\(\color{dodgerblue}{\textbf{Scaling}}\)

\(\color{darkblue}{\textbf{Patchwork}}\)


\(\color{dodgerblue}{\textbf{Layout}}\)

\(\color{skyblue}{\textrm{- Basic}}\)


\(\color{skyblue}{\textrm{- Setting Columns and Rows}}\)



\(\color{skyblue}{\textrm{- Advanced Layouts}}\)



\(\color{dodgerblue}{\textbf{Visual Settings}}\)

\(\color{skyblue}{\textrm{- Setting Sizes}}\)

heights(row1, row2, . . .)
widths(col1, col2, . . .)


\(\color{skyblue}{\textrm{- Adding Blank Space Between}}\)


\(\color{darkblue}{\textbf{More Tips}}\)